package org.loong.crypto.service.core.provider;

import org.loong.crypto.common.exception.CryptoException;
import org.loong.crypto.core.algorithm.CipherAlgorithm;
import org.loong.crypto.core.params.CipherParameters;

/**
 * Cipher Encrypter.
 */
public interface Encrypter extends CipherProvider {

    /**
     * Initialise the encrypter for encrypt.
     * 
     * @param parameters the cipher parameters.
     */
    default void init(CipherParameters parameters) {
        
    }
    
    /**
     * Encrypt data.
     * 
     * @param algorithm the algorithm
     * @param data the data to encrypt
     * @return the cipher text
     * @throws CryptoException the {@link CryptoException}
     */
    byte[] encrypt(final CipherAlgorithm algorithm, final byte[] data) throws CryptoException;
}
